﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Register : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        caldBirthday.SelectedDate = DateTime.Now;
        txtBirthday.Text =  caldBirthday.SelectedDate.ToString();
        
       
    }
    protected void btnRegister_Click(object sender, EventArgs e)
    {
        bussiness buss = new bussiness();
        Boolean flag = true;
        if(buss.checkEmail(txtEmail.Text))
        {
            lblerror.Text = "Email has been exist";
            flag = false;
        }
        if(buss.checkUsername(txtUserName.Text))
        {
            lblerror.Text = "UserName has been exist";
            flag = false;
        }
        if(flag)
        {
            Customer cus = new Customer();
            cus.Username = txtUserName.Text;
            cus.Password = txtPassword.Text;
            cus.Birthday =Convert.ToDateTime(txtBirthday.Text);
            cus.Email = txtName.Text;
            cus.Gender = dodlGender.SelectedValue;

            buss.insertCustomer(cus);
            lblerror.Text = "Register Sucessfull!";
        }

    }
    protected void caldBirthday_SelectionChanged(object sender, EventArgs e)
    {

    }
    //protected void caldBirthday_DayRender(object sender, DayRenderEventArgs e)
    //{
    //    if (e.Day.Date < (System.DateTime.Now.Date))
    //    {
            
    //        e.Day.IsSelectable = false;

    //        e.Cell.Font.Strikeout = true;

    //    }
    //}
    protected void caldBirthday_SelectionChanged1(object sender, EventArgs e)
    {
        DateTime date = caldBirthday.SelectedDate;
        txtBirthday.Text = date.ToString();
    }
}